package 补充.多线程;
class SubThread1 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
        }
    }
}
public class 线程插队 {
    public static void main(String[] args) throws InterruptedException {
        SubThread1 st1 = new SubThread1();
        Thread t1 = new Thread(st1,"线程1");
        t1.start();
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
            if (i == 5) {
                t1.join();
            }
        }
    }
}
